import java.io.*;
import java.util.*;

public class Parser
{
	public static int[][] parse(String strfile)
	{
		// Size of a Picture: h = Height, w = Width
		int h = 40, w = 60;
		int j, i;
		
		int[][] tab = new int[h][w];
		String line;
		
		File file = new File(strfile);
		Scanner scan;
		try
		{
			scan = new Scanner(new FileReader(file));
			
			for (i = 0; i < h; i++)
			{
				line = scan.nextLine();
				for (j = 0; j < w ; j++)
					tab[i][j] = getchar(line.charAt(j));
			}
		}
		catch (FileNotFoundException e) { System.out.println("File not Found: " + strfile); }
		
		return tab;
	}
	
	private static int getchar(char c)
	{
		int n;
		
		switch (c)
		{
			case '#' : // Bloc
				n = 1;
				break;
		    default :
				n = 0;
		}
		
		return n;
	}
	
	// Debugging Procedure
	public static void parsePrint(int[][] tab, int h, int w)
	{
		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
				System.out.print(tab[i][j]);
			System.out.println();
		}
		System.out.println();
	}
	
}
